Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add type hinting to test_helpers #1014

Merged
merged 6 commits into from
Sep 26, 2023

Conversation

tonyandrewmeyer
Copy link
Contributor

  • Add type hints to tests/test_helpers
  • For fake_script and fake_script_calls, there are a bunch of type: ignores to work around not being able to state the type of fake_script_path - I think there will be a few of these through other test modules as well, as hints are added there. I feel it would be cleaner to have the fake script functionality in a class rather than dynamically added to TestCase instances, but that is a much more substantial change

Partially addresses #1007

Copy link
Collaborator

@benhoyt benhoyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, yeah, some of these are definitely messy. Oh well, if it helps us get type checks turned on on our test directory, I think it's worth it.

path = test_case.fake_script_path / name
with path.open('wt') as f:
path: pathlib.Path = test_case.fake_script_path / name # type: ignore
with path.open('wt') as f: # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the joys of Python type checking! :-)

@benhoyt benhoyt merged commit b2c4a3e into canonical:main Sep 26, 2023
17 checks passed
@tonyandrewmeyer tonyandrewmeyer deleted the pyright-test_helpers-1007 branch September 26, 2023 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants